<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>查看数据</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../assets/libs/layui/css/layui.css" media="all">
</head>

<body>

    <form class="layui-form" lay-filter="example">

        <div class="layui-form-item" style="margin-top: 20px">
            <label class="layui-form-label">帖子编号:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="infoId" disabled="true" autocomplete="off" placeholder="" id="infoId"
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" style="margin-top: 20px">
            <label class="layui-form-label">帖子标题:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="infoTitle" lay-verify="title" autocomplete="off" placeholder="" disabled="true"
                    id="infoTitle" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="margin-top: 20px">
            <label class="layui-form-label">帖子用户:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="userName" lay-verify="title" autocomplete="off" placeholder="" disabled="true"
                    id="userName" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="margin-top: 20px">
            <label class="layui-form-label">帖子时间:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="infoTime" lay-verify="title" autocomplete="off" placeholder="" disabled="true"
                    id="infoTime" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">帖子类型:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="infoType" lay-verify="required" placeholder="" disabled=" true" id="infoType"
                    autocomplete="off" class="layui-input">
            </div>
        </div>

        <div id="type_1" style="display: none;">
            <div class="layui-form-item">
                <label class="layui-form-label">领取方式:</label>
                <div class="layui-input-block" style="margin-right: 20px">
                    <input type="text" name="infoReceive" lay-verify="required" placeholder="" disabled=" true"
                        id="infoReceive" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">体内驱虫:</label>
                <div class="layui-input-block" style="margin-right: 20px">
                    <input type="text" name="infoDewo" lay-verify="required" placeholder="" disabled=" true"
                        id="infoDewo" autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item" style="margin-top: 20px">
                <label class="layui-form-label">宠物类型:</label>
                <div class="layui-input-block" style="margin-right: 20px">
                    <input type="text" name="infoSpecies" lay-verify="title" autocomplete="off" placeholder=""
                        disabled="true" id="infoSpecies" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">绝育:</label>
                <div class="layui-input-block" style="margin-right: 20px">
                    <input type="text" name="infoSterilization" lay-verify="required" placeholder="" disabled=" true"
                        id="infoSterilization" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">疫苗:</label>
                <div class="layui-input-block" style="margin-right: 20px">
                    <input type="text" name="infoVaccines" lay-verify="required" placeholder="" disabled=" true"
                        id="infoVaccines" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">帖子内容:</label>
            <div class="layui-input-block" style="margin-right: 20px">
                <input type="text" name="infoComm" lay-verify="required" placeholder="" disabled=" true" id="infoComm"
                    autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">帖子图片:</label>
            <div class="layui-input-block" style="margin-right: 20px" id="infoImgList">

            </div>
        </div>


    </form>

    <style>
        #infoImgList img {
            margin: 5px;
        }
    </style>
    <script src="../../assets/libs/layui/layui.js" charset="utf-8"></script>
    <script src="../js/util.js" charset="utf-8"></script>
    <script>

        function get_infoType(infoType) {
            return ['发布领养', '我想领养', '寻宠启示', '宠物二三事'][infoType]
        }

        function get_state(state) {
            return ['否', '是', '不详'][state]
        }

        layui.config({
            base: '/module/'
        }).use(['jquery', 'layer', 'table', 'form', 'config'], function () {
            var $ = layui.jquery;
            var layer = layui.layer;
            var table = layui.table;
            var form = layui.form;
            var config = layui.config;
            var req = GetRequest();

            var no = req['editNo'];
            $.ajax({
                url: config.base_server + 'getInfoById?editNo=' + no,
                dataType: 'json',
                type: 'get',
                success: function (data) {
                    data = data.data;
                    $('#infoId').val(data.infoId);
                    $('#infoTitle').val(data.infoTitle);
                    $('#userName').val(data.userName);
                    $('#infoType').val(get_infoType(data.infoType));
                    $('#infoTime').val(data.infoTime);
                    $('#infoComm').val(data.infoComm);
                    $('#inforReceive').val(data.inforReceive);
                    if (data.infoType == 0) {
                        $('#type_1').show()
                        $('#infoSterilization').val(get_state(data.infoSterilization))
                        $('#infoVaccines').val(get_state(data.infoVaccines))
                        $('#infoDewo').val(get_state(data.infoDewo))
                        $('#infoReceive').val(data.infoReceive)
                        $('#infoSpecies').val(data.infoSpecies);
                    }
                    (data.infoImgList).forEach(item => {
                        $('#infoImgList').append('<img  src="' + item + '" alt="" srcset="" disabled="true" name="rticleaImg" id="rticleaImg" width="100" height="100" />');
                    })
                }
            })
        });
    </script>
</body>